public class ThreadLock{
    public static void main(String[] args) {
      Thread t1=new Thread(()->{
          synchronized (Integer.class){
              System.out.println("t1加锁");
              try {
                  Thread.sleep(200);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              synchronized (long.class){
                  System.out.println("t1释放锁");
              }
          }

      });
      t1.setDaemon(true);
      t1.start();
      Thread t2=new Thread(()->{
          synchronized (long.class){
              System.out.println("t2加锁");
              synchronized (Integer.class){
                  System.out.println("t2释放锁");
              }
          }
      });
      t2.start();
}
}
